package com.ruoyi.web.controller.manage;

import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.manage.domain.AppUser;
import com.ruoyi.manage.domain.request.FaceThanRequest;
import com.ruoyi.manage.domain.request.IdentityInformationRequest;
import com.ruoyi.manage.domain.request.VerificationCodeRequest;
import com.ruoyi.manage.service.IAppAuthenticationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: wwy
 * @Date: 2021/3/3 15:00
 */
@Api("移动端认证")
@RestController
@RequestMapping("/api")
public class AppAuthenticationController {
      @Autowired
     private IAppAuthenticationService appAuthenticationService;
     /**
      * 获取身份信息
      * @param identityInformationRequest
      * @return
      */
     @ApiOperation("获取身份信息")
     @PostMapping("/getIdentityInformation")
     public AjaxResult getIdentityInformation(@RequestBody IdentityInformationRequest identityInformationRequest){
          return appAuthenticationService.getIdentityInformation(identityInformationRequest);
     }

     /**
      * 人脸比对
      * @param faceThanRequest
      * @return
      */
     @ApiOperation("人脸比对")
     @PostMapping("/faceThan")
     public AjaxResult faceThan(@RequestBody FaceThanRequest faceThanRequest){
          return appAuthenticationService.faceThan(faceThanRequest);
     }

     /**
      * 保存用户信息
      * @param appUser
      * @return
      */
     @ApiOperation("保存认证信息")
     @PostMapping("/saveInfo")
     public AjaxResult saveInfo(@RequestBody AppUser appUser){
          return appAuthenticationService.saveInfo(appUser);
     }

     /**
      * 获取用户条款
      * @return
      */
     @ApiOperation("获取用户条款")
     @GetMapping("/getUserTerms")
     public AjaxResult getUserTerms(){
          return appAuthenticationService.getUserTerms();
     }


     /**
      * 发送手机验证码
      * @return
      */
     @ApiOperation("发送手机验证码")
     @PostMapping("/getPhoneVerification")
     public AjaxResult getPhoneVerification(@RequestBody VerificationCodeRequest verificationCodeRequest){
          return appAuthenticationService.getPhoneVerification(verificationCodeRequest);
     }


     /**
      * 保存用户信息
      * @param appUser
      * @return
      */
     @ApiOperation("保存认证信息新版")
     @PostMapping("/saveInfoNew")
     public AjaxResult saveInfoNew(@RequestBody AppUser appUser){
          return appAuthenticationService.saveInfoNew(appUser);
     }
}
